#include "unp.h"

#define IPLINE 32

int main(int argc,char *argv[])
{
    struct in_addr s;
    char ip[IPLEN],dst[IPLEN];

    memset(ip,0x0,sizeof(ip));
    memset(dst,0x0,sizeof(ip));
    if(argc != 2){
        err_sys("Usage:inet_pton_ex <IP>");
    }else{
        #snprintf(ip,sizeof(ip),"%s",argv[1]);
        strncpy(ip,argv[1],sizeof(ip));
    }
    
    inet_pton(AF_INET,ip,(void *)&s);
    printf("%s inet exp is 0X%X\n",ip,s.s_addr);

    inet_ntop(AF_INET,(void *)&s,dst,sizeof(dst));
    printf("0X%X inet_ntop is %s\n",s.s_addr,dst);
    
    return 0;
}
